package src.com.neusoft.nep.controller;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URL;

public class AdminViewController {
    @FXML
    private StackPane stackPane;

    public void loadView(String fxmlFilePath) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource(fxmlFilePath);
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        stackPane.getChildren().setAll(root);
    }
    public void psdl() throws IOException {
        loadView("../view/PubliclySupervisedDateListView.fxml");
    }
    public void cadl() throws IOException {
        loadView("../view/ConfirmAQIDateListView.fxml");
    }
    public void ADSV() throws IOException {
        loadView("../view/AQIDistributeStatisticsView.fxml");
    }
    public void ADTV() throws IOException {
        loadView("../view/AQIDistributeTendView.fxml");
    }
    public void OD() throws IOException {
        loadView("../view/OtherDistribute.fxml");
    }
    public void PAS() throws IOException {
        loadView("../view/ProvinceAQIStatistics.fxml");
    }

    @FXML
    private Button btn_exit;
    public void exit() throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../view/AdminUserLoginView.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_exit.getScene();
        scene.setRoot(root);
        Stage stage = (Stage)scene.getWindow();
        stage.getScene();
        stage.show();
    }
}
